#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int n,a[100050],f,p,q,k=1,ans,sb;
int b[100005],c[100005];
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        int kk=a[i];
        if(kk>2) f=1;
        if(kk==1) p++;
        else if(kk==2) q++;
    }
    if(f==0)
    {
        if(p<=q) cout<<q;
        else cout<<n-q;
        return 0;
    }
    else
    {
        sort(a+1,a+n+1);
        for(int i=1;i<=n;i++)
        {
            if(a[i]!=a[i+1]||i==n)
            {
                c[k]=i-b[k-1]-c[k-1];
                b[k]=i-c[k];
                k++;
            }
        }
        k--;
        for(int i=2;i<=k;i++)
        {
            if(c[i]>=b[i])
            {
                for(int j=i+1;j<=k;j++) b[j]-=b[i];
            }
            else
            {
                for(int j=i+1;j<=k;j++) b[j]-=c[i];
            }
        }
        cout<<b[k];
    }
    fclose(stdin);
    fclose(stdout);
    return 0;
}
